package com.roncoo.permission.controller;


import com.roncoo.permission.entity.AdminroleTMenu;
import com.roncoo.permission.entity.TMenu;
import com.roncoo.permission.service.IAdminroleTMenuService;
import com.roncoo.permission.service.ITMenuService;
import com.roncoo.role.entity.Adminrole;
import org.apache.velocity.runtime.directive.Foreach;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yuechuanhao
 * @since 2021-03-29
 */
@RestController
@RequestMapping("/t-menu")
public class TMenuController {

    @Resource
    private ITMenuService itMenuService;

    @Resource
    private IAdminroleTMenuService iAdminroleTMenuService;

    /**
     * 所有权限
     * @return
     */
    @PostMapping("menuAll")
    public List<TMenu> menuAll(){
        return itMenuService.menuAll();
    }

    /**
     * 查询角色有哪些权限
     * @return
     */
    @GetMapping("menuSon")
    public List<AdminroleTMenu> menuSon(Integer roleId){
        return iAdminroleTMenuService.menuSon(roleId);
    }
    @GetMapping("menuSon1")
    public List<AdminroleTMenu> menuSon1(Integer roleId){
        System.out.println(1111111);
        return iAdminroleTMenuService.menuSon1(roleId);
    }
    /**
     * 修改权限
     */
    @GetMapping("menuUpdata")
    public boolean menuUpdata(String mid,Integer roleid){
        return iAdminroleTMenuService.deleteByroleId(mid,roleid);
    }
}

